Add combined results and plot generation - #219
Conversation
|
@avolkov-intel Please document these options in the .md files where the other options are described. |
ceda047 to
1886459
Compare
Done |
|
CI failures are not related to this PR |
| | `--performance-stability-metrics`</br>`-psm` | | False | | Adds performance stability metrics (`1st run time[ms]`, `1st-mean run ratio`, `median time[ms]`, `time CV`) to the report. | | ||
| | `--combined-results` | | False | | [EXPERIMENTAL] Creates `All cases` and `Summary (for plots)` sheets combining time and speedup of all algorithms with per-dtype/total GEOMEAN rows (use with `--compatibility-mode`). | | ||
| | `--draw-plots` | | False | | [EXPERIMENTAL] Draws Training/Inference speedup bar charts from the combined results (requires `--combined-results`). | | ||
| | `--plot-output` | str | None | | [EXPERIMENTAL] Output file path for plots (e.g. `plots.png`); if unset, plots are shown interactively. | |
There was a problem hiding this comment.
Does this require passing --draw-plots?
There was a problem hiding this comment.
Well technically no, you can provide it without draw plots it would be just ignored
There was a problem hiding this comment.
Please add that kind of detail in these docs.
|
@avolkov-intel Would this work when comparing against cuml? If so, how would it handle cases where parameters do not match? |
| | `--compatibility-mode` | | False | | [EXPERIMENTAL] Compatibility mode drops and modifies results to make them comparable (for example, sklearn and cuML parameters). | | ||
| | `--performance-stability-metrics`</br>`-psm` | | False | | Adds performance stability metrics (`1st run time[ms]`, `1st-mean run ratio`, `median time[ms]`, `time CV`) to the report. | | ||
| | `--combined-results` | | False | | [EXPERIMENTAL] Creates `All cases` and `Summary (for plots)` sheets combining time and speedup of all algorithms with per-dtype/total GEOMEAN rows (use with `--compatibility-mode`). | | ||
| | `--draw-plots` | | False | | [EXPERIMENTAL] Draws Training/Inference speedup bar charts from the combined results (requires `--combined-results`). | |
There was a problem hiding this comment.
This option without --plot-output doesn't appear to do anything. It doesn't show anything interactive for me, or at least not when used in an SSH session.
|
@avolkov-intel Please add information about how to generate a publication-grade plot, with details in the bottom text filled in. |
| ws = wb.create_sheet(title="All cases", index=1) | ||
| row, geomean_rows = 1, [] | ||
|
|
||
| def geomean_row(label, r0, r1): |
There was a problem hiding this comment.
Please make row a parameter.
| return df | ||
|
|
||
|
|
||
| def write_all_cases_2_sheet(dfs, wb): |
There was a problem hiding this comment.
Please add a description of what wb is. Better yet if you can add type hints.
| Each block ends with per-dtype and total GEOMEAN formula rows plus a speedup color scale. | ||
| Returns list of (group_name, total_geomean_row, {dtype: geomean_row}) for the summary sheet. | ||
| """ | ||
| KNN = ("KNeighborsClassifier", "KNeighborsRegressor") |
There was a problem hiding this comment.
What about LocalOutlierFactor and NearestNeighbors?
There was a problem hiding this comment.
We currently don't report performance for them, so they are not present
| if c in gdf.columns | ||
| ] | ||
| if sort_cols: | ||
| gdf = gdf.sort_values(sort_cols, kind="mergesort") |
There was a problem hiding this comment.
Is this trying to do a stable sort? Otherwise, why pass the parameter?
There was a problem hiding this comment.
Yes, the idea is to have stable sort
| j = i | ||
| while j + 1 < len(dtypes) and dtypes[j + 1] == dtypes[i]: | ||
| j += 1 | ||
| dtype_rows[dtypes[i]] = geomean_row( |
There was a problem hiding this comment.
Since this one doesn't embed geomean as a formula, maybe the code could be a lot more readable if this were to pre-generate subtables as dataframes and store them in a list to write at the end.
There was a problem hiding this comment.
In fact the idea is indeed to embed geomean as a formula. On review they often want formulas to be present in excel spreadsheet rather than calculated outside of it for clarity. You can see here we insert it as a formula: https://github.com/IntelPython/scikit-learn_bench/pull/219/changes#diff-24c57e4b1e3d9bbd1fa3cd538fca5b437e68987456662773afc60a67afdeabc5R627
| return [f"={src_sheet_name}!{c}{row_num}" for c in "BCD"] | ||
|
|
||
| def write_section(title, rows): | ||
| nonlocal current_row |
There was a problem hiding this comment.
Please switch it to parameter.
| new_ws.append([None]) | ||
|
|
||
|
|
||
| def draw_summary_plots(all_cases_df: pd.DataFrame, output_file: str = None): |
There was a problem hiding this comment.
Would be helpful to have a sub-function to generate the plot returning matplotlib objects (plt, fig, axes).
ethanglaser
left a comment
There was a problem hiding this comment.
LGTM if it works for you. But address David's comments to his satisfaction before merge.
no, currently it's only designed to work for sklearn vs sklearnex comparison |
2f671bd to
2078312
Compare
|
Addressed comments from David |
Description
New CLI options
--combined-results— builds two extra sheets:brute/kd_tree; rows sorted by dtype then dataset; each group ends with per-dtype and total
GEOMEANformula rows with a per-group speedup color scale.section and total geomeans.
--draw-plots/--plot-output <path>— renders a Training/Inference speedup bar chart (geomean per algorithm, combining fp32 & fp64) withIntel-branded titles and disclaimer footnote.
Other changes
--performance-stability-metricsnow additionally emits amedian time[ms]column (alongside existing1st run time[ms],time CV), included in theindividual sheets and "All cases".
Use
--compatibility-modetogether with--combined-resultsso sklearn/sklearnex rows merge correctly.Completeness and readability
Testing